﻿@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>苏迈克斯协同办公系统</title>
    <!--通用代码块开始-->
    <link href="@Url.Content("~/Content/ExtJS/resources/css/ext-all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Content/ExtJS/bootstrap.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/javascript/common.js")" type="text/javascript"></script>
    <style type="text/css">
     .x-tab-default-top button, .x-tab-default-top .x-tab-inner /*单写.x-tab-inner无用*/
    {
        height: 16px;
        line-height: 120%;
    }
    </style>
    <!--通用代码块完成-->
    <!--将涉及视图引擎变量的JS脚本写在下面代码块里-->
    <script type="text/javascript">
        var UserID = "@BuizApp.Models.LoginModel.getUserName(Html.ViewContext.HttpContext.User.Identity.Name)";
        var MenuJson = @Html.Raw(@TempData["MenuJson"].ToString());
    </script>
    <!--以下代码块与视图引擎无关-->
    <script type="text/javascript">
        Ext.onReady(function () {

            new Ext.container.Viewport({
                id: 'Viewport',
                layout: "border",
                padding: 5,
                defaults: {
                //bodyStyle: 'padding:5px;'
            },
            items: [{
                region: "north",
                xtype: "container",
                margins: '0 0 5 0',
                height: 24,
                bodyPadding: 15,
                layout: 'hbox',
                style: {
                    'background-color': '#dfe8f6',
                    'text-align': 'right'
                },
                items: [
                        { xtype: 'label', flex: 1, text: '苏 迈 克 斯 协 同 办 公 系 统', style: 'text-align:left; padding:2px; font-size:22px; font-weight:bolder; color:#225588; font-family: 华文行楷;' },
                        { xtype: 'label', text: '当前用户：' + UserID + '', margin: '2 0 0 0' },
                        { xtype: 'button', text: '修改密码', margin: '0 0 0 20', handler: function () { Ext.example.msg("修改密码", "暂未实现"); } },
                        { xtype: 'button', text: '退出系统', margin: '0 0 0 20', handler: function () { window.location = '/login'; } }
                    ]
            }, {
                region: 'west',
                //xtype: 'container',  // 写在配置对象里要描述xtype,直接创建组件不需要，已经在组件类型里了
                layout: 'accordion',
                split: true,
                collapsible: true,
                //collapseMode: 'mini',
                title: '系统菜单',
                width: 160,
                frame: true,
                minSize: 120,
                defaults: {
                    border: false
                },
                margin: 0,
                padding: 0,
                items: MenuJson
            }, {
                xtype: 'container',
                region: 'south',
                height: 0,
                //html: 'South',
                margins: '0 0 0 0',
                bodyPadding: 0,
                padding: 0
            }
                , {
                    region: 'center',
                    id: 'mainTabPanel',
                    xtype: 'tabpanel',
                    //                    border: 0,
                    //                    bodyBorder: false,
                    //frame: true,
                    enableTabScroll: true,
                    //deferredRender: true,
                    defaults: {
                        hideMode: 'offsets'
                    },
                    activeTab: 0,
                    items: [{
                        id: "myDesk",
                        title: '我的桌面',
                        html: '<iframe src="/main/mydesk" width="100%" height="100%" frameborder="0" ></iframe>'
                    }
                    ],
                    bodyPadding: 0
                }]
        });

        //        window.setTimeout(
        //        Ext.TaskManager.start({
        //            run: function () {
        //                Ext.Ajax.request({
        //                    url: '/data/info/unReadCount',
        //                    success: function (response, opts) {
        //                        if (response.responseText != '0')
        //                            Ext.example.msg("有未读消息", "您有{0}条未读消息,请查收!", response.responseText);
        //                    },
        //                    failure: function (response, opts) {
        //                        debugger;
        //                    }
        //                });
        //            },
        //            interval: 10000 //1 second
        //        }), 20000);


        window.setInterval(function () {
            Ext.Ajax.request({
                url: '/data/info/unReadCount',
                success: function (response, opts) {
                    if (response.responseText != '0')
                        Ext.example.msg("有未读消息", "您有{0}条未读消息,请查收!", response.responseText);
                },
                failure: function (response, opts) {
                    debugger;
                }
            });
        },
            20000
            );

        //        Ext.select('.MBmenu a').each(function (s, w, index) { //s:Element,w:Composite
        //            s.on("click", function (e) {
        //                var url = e.getTarget().href;
        //                //debugger;
        //                e.preventDefault(); //这样才能阻止链接，return false;不行，参考 http://yiminghe.javaeye.com/blog/368860
        //                addTab(url, e.getTarget().innerText || e.getTarget().text, url);
        //            }
        //               );
        //        });

        //        Ext.select('.MBmenu li').each(function (s, w, index) {
        //            s.on('mouseenter', setEnter);
        //            s.on('mouseleave', setLeaver);
        //        });

        //        function setEnter(e, t) {
        //            t.className = "MBmenuItemEnter";
        //        }

        //        function setLeaver(e, t) {
        //            t.className = "";
        //        }
    });
    </script>
</head>
<body>
</body>
</html>
